import { extendObservable } from 'mobx';

export default class Rule {
    constructor(state) {
        this.state = state;
        extendObservable(this, {
            get test() {
                if (this.state.test.length > 10) {
                    return {
                        validateStatus: 'error',
                        help: '不能超过10个字符',
                    };
                }

                return {
                    validateStatus: 'success',
                    help: '成功',
                };
            },

            get accountFirstName() {
                console.log(this.state.account.firstName,4444)
                if (this.state.account.firstName.length > 10) {
                    return {
                        validateStatus: 'error',
                        help: '不能超过10个字符',
                    };
                }

                return {
                    validateStatus: 'success',
                    help: '',
                };
            },

        });
    }
}
